package com.calm.editor.entity;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.google.gson.annotations.Expose;

@Table(name = "XHTML_PAGE_RESOURCE")
@Entity
public class Resource implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "ID")
	@GeneratedValue
	private Integer id;

	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH,
			CascadeType.REMOVE, CascadeType.PERSIST })
	@JoinColumn(name = "PAGE_ID")
	@Expose(serialize = false)
	private Page page;

	@Column(name = "URI", length = 2048)
	private String uri;

	@Enumerated(EnumType.STRING)
	@Column(name = "TYPE")
	private ResourceType type;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getUri() {
		return uri;
	}

	public void setUri(String uri) {
		this.uri = uri;
	}

	public ResourceType getType() {
		return type;
	}

	public void setType(ResourceType type) {
		this.type = type;
	}

	public Page getPage() {
		return page;
	}

	public void setPage(Page page) {
		this.page = page;
	}

}
